package cn.com.code.generator.aspect;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.Ordered;
import org.springframework.stereotype.Component;

@Aspect
@Component
public class MethodAnnotationAspect implements Ordered {
    private final static transient Logger logger = LoggerFactory.getLogger(MethodAnnotationAspect.class);

    public MethodAnnotationAspect(){

    }
    @Pointcut("@annotation(cn.com.code.generator.annotation.MethodAnnotation)")
    public void methodAnnotationPointCut() {
    }

    @Around("methodAnnotationPointCut()")
    public Object around(ProceedingJoinPoint point) throws Throwable {
        logger.info("method befor==");
        Object result = point.proceed();
        logger.info("method after==");
        return result;
    }

    @Override
    public int getOrder() {
        return 1;
    }
}
